/* 
 * File:   EventDetection.cpp
 * Author: agnesschaap
 * 
 * Created on 23 juni 2010, 12:23
 */

#include "EventDetection.h"
#include "Button.h"

/*
 * flag 0 = theSetButton DOWN
 * flag 1 = theSetButton UP
 * flag 2 = theModeButton DOWN
 * flag 3 = theModeButton UP
 */
  
EventDetection::EventDetection(Button* setButton,Button* modeButton):
	cTask("eventDetectionTask",3,100), theSetButton(setButton), theModeButton(modeButton) {	
	std::cout << "Constructed EventDetectionTask\n";    
}

void EventDetection::init() {
	block();
}

void EventDetection::update() {
	if(theSetButton->buttonDown()) {
        theSetButton->getListener()->buttonDown(theSetButton);
    }

    if(theSetButton->buttonUp()) {
        theSetButton->getListener()->buttonUp(theSetButton);
    }

    if(theModeButton->buttonDown()) {
        theModeButton->getListener()->buttonDown(theModeButton);
    }

    if(theModeButton->buttonUp()) {
        theModeButton->getListener()->buttonUp(theModeButton);
    }
    block();
}

